package com.powergisol.core.model;

public class Tangent {

    /**
     * 边的起始点
     */
    private PointWithIndex pointStart;
    /**
     * 边的结束点
     */
    private PointWithIndex pointEnd;


    private int level;

    public Tangent( PointWithIndex pointStart,PointWithIndex pointEnd, int  level){
        this.pointStart = pointStart;
        this.pointEnd = pointEnd;
        this.level = level;
    }

    public PointWithIndex getPointStart() {
        return pointStart;
    }

    public PointWithIndex getPointEnd() {
        return pointEnd;
    }

    public int getLevel() {
        return level;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Tangent tangent = (Tangent) o;

        if (level != tangent.level) return false;
        if (pointStart != null ? !pointStart.equals(tangent.pointStart) : tangent.pointStart != null) return false;
        return pointEnd != null ? pointEnd.equals(tangent.pointEnd) : tangent.pointEnd == null;
    }

    @Override
    public int hashCode() {
        int result = pointStart != null ? pointStart.hashCode() : 0;
        result = 31 * result + (pointEnd != null ? pointEnd.hashCode() : 0);
        result = 31 * result + level;
        return result;
    }

    @Override
    public String toString() {
        return "Tangent{" +
                "pointStart=" + pointStart +
                ", pointEnd=" + pointEnd +
                ", level=" + level +
                '}';
    }
}
